# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2022/8/18 15:23
# @Author : xyjiang1216
# @Email : jiangxuyan@nudt.edu.cn
# @File : table.py
# @Version: OpenTSN_planner_builder 1.0

'''填充表格的代码'''

# '''填充左侧列表内容'''
# # self.model = QStringListModel()
# self.model_1 = QStandardItemModel()
# self.ui.nodeList.setViewMode(QListView.IconMode)
# self.node_list, self.node_port_list = parse_plan_xml(plan_file,
#                                                      topo_file)
# icon_list = []
# for item in self.node_list:
#     icon = QStandardItem(QIcon('img/sw.png'), item)
#     icon_list.append(icon)
# self.model_1.appendColumn(icon_list)
# # self.model.setStringList(self.list)
# self.ui.nodeList.setModel(self.model_1)
#
# '''填充右侧表格内容'''
# # 获取第一个网络节点的端口数量以及时间槽数量，以确定表的
# # 行数和列数
#
# # 获取时间槽长度，调度周期长度
# time_slot, hyper_period = get_slot_and_hyper_period(flow_file,
#                                                     topo_file)
# time_slot_num = int(hyper_period / time_slot)
#
# # 获取第一个网络节点的端口数量
# port_num = len(self.node_port_list[0]['port_set'])
#
# rows = port_num  # 表格的行数是端口数量
# cols = time_slot_num  # 表格的列数是时间槽数量
#
# self.model_2 = QStandardItemModel(rows, cols)
# self.model_2.setHorizontalHeaderLabels(['slot%d' % i for i in range(cols)])
# self.model_2.setVerticalHeaderLabels(['port%s' % i for i in self.node_port_list[0]['port_set']])
# for row in range(rows):
#     for col in range(cols):
#         item = QStandardItem(str(row))
#         self.model_2.setItem(row, col, item)
# self.ui.nodeTable.setModel(self.model_2)